import React, {Component} from 'react';
import './index.less';
import {base} from 'nc-lightapp-front';
import TransInOut from "./components/TransInOut";
import NCBackBtn from "../../../../../../hrpub/common/components/hr-back";

const {NCTabs} = base;
const NCTabPane = NCTabs.NCTabPane;

class CrossTrans extends Component {
    constructor(props) {
        super(props);
        this.state = {
            transType: '1'
        };
        this.goBack = this.goBack.bind(this);
        this.tabChange = this.tabChange.bind(this);
    }

    tabChange(transType) {
        this.setState({
            transType
        })
    }

    goBack() {
        this.props.goBack();
    }

    render() {
        const {transType} = this.state;

        const tabs = [{
            key: '1',
            text: this.props.json['hi6007-000155']/* 国际化处理： 跨组织调出*/
        }, {
            key: '2',
            text: this.props.json['hi6007-000156']/* 国际化处理： 跨组织调入*/
        }];
        return (
            <div className='cross-trans'>
                <div className='header'>
                    <NCBackBtn onClick={this.goBack}/>
                    <NCTabs
                        navtype="turn"
                        contenttype="moveleft"
                        tabBarPosition="top"
                        destroyInactiveTabPane={true}
                        activeKey={transType}
                        onChange={this.tabChange}
                    >
                        {
                            tabs.map(item =>
                                <NCTabPane tab={item.text} key={item.key}/>)
                        }
                    </NCTabs>
                </div>

                <TransInOut {...this.props} transType={transType} json={this.props.json}/>
            </div>
        );
    }
}

export default CrossTrans;
